package com.example.tests;

public class ContactObject {
//	public static String[] MONTHS = new String[]{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
	public String firstname;
	public String lastname;
	public String address;
	public String telhome;
	public String telmobile;
	public String telwork;
	public String birthday;
	public String birthmonth;
	public String birthyear;
	public String group;
	public String email;
	public String email2;
	public String address2;
	public String phone2;
	public String id;
	
	public ContactObject setFirstName(String firstname) {
		this.firstname = firstname;
		return this;
	}
	public ContactObject setLastName(String lastname) {
		this.lastname = lastname;
		return this;
	}
	public ContactObject setAddress(String address) {
		this.address = address;
		return this;
	}
	public ContactObject setTelHome(String telhome) {
		this.telhome = telhome;
		return this;
	}
	public ContactObject setTelMobile(String telmobile) {
		this.telmobile = telmobile;
		return this;
	}
	public ContactObject setTelWork(String telwork) {
		this.telwork = telwork;
		return this;
	}
	public ContactObject setBirthDay(String birthday) {
		this.birthday = birthday;
		return this;
	}
	public ContactObject setBirthMonth(String birthmonth) {
		this.birthmonth = birthmonth;
		return this;
	}
	public ContactObject setBirthYear(String birthyear) {
		this.birthyear = birthyear;
		return this;
	}
	public ContactObject setGroup(String group) {
		this.group = group;
		return this;
	}
	public ContactObject setEmail(String email) {
		this.email = email;
		return this;
	}
	public ContactObject setEmail2(String email2) {
		this.email2 = email2;
		return this;
	}
	public ContactObject setAddress2(String address2) {
		this.address2 = address2;
		return this;
	}
	public ContactObject setPhone2(String phone2) {
		this.phone2 = phone2;
		return this;
	}
	
	public ContactObject setId(String id) {
		this.id = id;
		return this;
	}
	@Override
	public String toString() {
		return "Contact [" + id + "," + firstname + "," + lastname + "]";
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((firstname == null) ? 0 : firstname.hashCode());
//		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((lastname == null) ? 0 : lastname.hashCode());
		return result;
	}

	@Override
	 public boolean equals(Object obj) {
	  if (this == obj)
	   return true;
	  if (obj == null)
	   return false;
	  if (getClass() != obj.getClass())
	   return false;
	  
	  ContactObject other = (ContactObject) obj;
	  if (firstname == null) {
	   if (other.firstname != null)
	    return false;
	  } else if (!firstname.equals(other.firstname))
	   return false;
	  
	  if (lastname == null) {
	   if (other.lastname != null)
	    return false;
	  } else if (!lastname.equals(other.lastname))
	   return false; 
	  
	  if (id != null && other.id != null)
	   return id.equals(other.id);
	  return true;
	 }
}
	